﻿using System;
using System.Collections.Generic;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;

namespace NotWindowsStoreMetro
{
    partial class App
    {
        private static NotWindowsStoreDataSource _dataSource = new NotWindowsStoreDataSource();

        public App()
        {
            InitializeComponent();
        }

        public static App CurrentApp
        {
            get { return (App)Application.Current; }
        }

        public NotWindowsStoreDataSource DataSource
        {
            get { return _dataSource; }
        }

        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            ShowGroupedCollection();
            Window.Current.Activate();
        }

        public static void ShowGroupedCollection()
        {
            var page = new GroupedCollectionPage();
            Window.Current.Content = page;
        }

        public static void ShowCollectionSummary(IEnumerable<object> collection)
        {
            var page = new CollectionSummaryPage();
            page.Items = collection;
            page.Item = collection;
            Window.Current.Content = page;
        }

        public static void ShowDetail(IEnumerable<object> collection, object item)
        {
            var page = new DetailPage();
            page.Items = collection;
            page.Item = item;
            Window.Current.Content = page;
        }
    }
}
